package com.maz.androidprojectcomponenttest.fragment;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.util.Log;

public class TestDialog extends DialogFragment implements OnClickListener {
	private final static String TAG = TestDialog.class.getName();
	@Override
	public Dialog onCreateDialog(Bundle savedInstanceState) {
		return buildDialog();
	}
	
	private Dialog buildDialog(){
		return new AlertDialog.Builder(getActivity())
					.setTitle("Testing Dialog")
					.setMessage("Please Click OK if you want.")
					.setPositiveButton("OK", this)
					.setNegativeButton("Cancel", this)
					.create();
	}

	@Override
	public void onClick(DialogInterface dialog, int which) {
		Log.d(TAG, "Which is clicked: "+ which);
	}
}
